package com.yair_srm.integration.sap.impl;

import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoException;
import com.sap.conn.jco.JCoFunction;
import com.yair_srm.integration.sap.ISAP;

public class SAP_AS_POOL{
	
//	private static String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL_IDES";
	private static String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL_YAIR";
//	private static String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL_YAI";
	private static JCoDestination destination ;
	private static SAP_AS_POOL instance;
    static{
    	try {
			destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
		} catch (JCoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		instance = new SAP_AS_POOL();
    }
    
    public static JCoDestination getDestination(){
    	return destination;
    }
    
    public static SAP_AS_POOL getInstance(){
    	return SAP_AS_POOL.instance;
    }
    
	public JCoFunction fetchfunction(String functionname) throws JCoException {
		// TODO Auto-generated method stub
		return SAP_AS_POOL.getDestination().getRepository().getFunction(functionname);		
	}

}
